﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace FreeFlow.Administration
{
  /// <summary>
  /// Contains a single tracking data entry for a workflow instance
  /// </summary>
  public class WorkflowInstanceTracking
  {
    internal WorkflowInstanceTracking(IDataReader reader)
    {
      time = (DateTime)reader["eEventDateTime"];
      activityName = reader["eQualifiedName"].ToString();
      activityType = reader["eActivityType"].ToString();
      executionStatus = reader["eExecutionStatus"].ToString();
      eventType = reader["eTrackingEventType"].ToString();
      workflowEvent = reader["eTrackingWorkflowEvent"].ToString();
      userData = reader["eUserData"].ToString();
    }

    private DateTime time;
    /// <summary>
    /// Gets the time the event occurred.
    /// </summary>
    public DateTime Time
    {
      get
      {
        return time;
      }
    }

    private string activityType;
    /// <summary>
    /// Gets the type of the activity being executed.
    /// </summary>
    public string ActivityType
    {
      get { return activityType; }
    }

    private string executionStatus;
    /// <summary>
    /// Gets the execution status of the activity.
    /// </summary>
    public string ExecutionStatus
    {
      get { return executionStatus; }
    }

    private string activityName;
    /// <summary>
    /// Gets the name of the executing activity.
    /// </summary>
    public string ActivityName
    {
      get { return activityName; }
    }

    private string eventType;
    /// <summary>
    /// Gets the type of the event.
    /// </summary>
    public string EventType
    {
      get { return eventType; }
    }

    private string workflowEvent;
    /// <summary>
    /// Gets the name of the workflow event, if this is a workflow event.
    /// </summary>
    public string WorkflowEvent
    {
      get { return workflowEvent; }
    }

    private string userData;

    /// <summary>
    /// Gets any user data associated with this event.
    /// </summary>
    public string UserData
    {
      get { return userData; }
    }
  }
}
